<!--发布说法-->
<template>
  <div class="bg bg1" @rightBtn="rightBtn">

    <textarea class="textarea font30 text2 bg2 mb30" 
    v-model="text" placeholder="请输入您对行情的看法"
    :maxlength="300"
    @input="onInput" 
    @focus="onFocus"
    @blur="onBlur" />

    <div class="row jend">
      <text class="font28 text1">{{text.length+'/300'}}</text>
    </div>
  </div>
</template>


<script>

//功能
import jhttps from "@/_js/https";
import jmodal from "@/_js/modal";
import jnavigator from "@/_js/navigator";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
weexFunction.setTitle(T('发布观点'));
weexFunction.setRightBtn(T('发布'));
export default {

  data() {
    return {
      text:'',
    };
  },

  created() {
  },

  methods: {


    /*************************************************通信触发*/
    //右按钮触发
    rightBtn() {

      if(!this.text) {
        jmodal.toast('请输入观点');
        return;
      }

      this.httpAddPoint();
    },

    /************************************************* http*/
    //http发布观点
    httpAddPoint() {
      jmodal.showLoad();
      var param = {'content': this.text};
      jhttps.post("point/addPoint", param, true,(data) => {
        jmodal.hideLoad();
        if (data.status == 200) {
          jmodal.toast('发布成功');
          jnavigator.back();
        } else {
          jmodal.toast(data.msg);
        }
      });
    },
    
    /**********************************************点击回调*/
    //输入框点击
    frameClick(){
      if (!this.isEdit){
        return;
      }
      this.$refs.input && this.$refs.input.focus();
    },

    //说明点击
    explainClick(){
      var parm = {'message':this.explain};
      jmodal.alert(parm,(bool)=>{});
    },

    //不可编辑蒙层
    noClick() {},

    /********************************** 点击触发*/
  },
};

</script>

<style src="@/_css/style.css" ></style>
<style scoped> 
.bg {
  flex: 1;
  padding: 40px 20px 0 20px;
}
.textarea {
  padding: 30px;

  height: 400px;
  border-radius: 6px;
}
</style>